﻿//********************************************************************************//
//创建日期：<创建日期，2017-03-28>
//创建作者：<孙雪婷，sunxueting@shanghai3h.com>
//功能说明：深层承压水取水井
//********************************************************************************//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Entity;
using BLL;
using BLL.Access;
using System.Data;
using Platform.Http;
using Web.Class;
using Platform.Common;

namespace Web.Pages.QuShui.ShuiLiPC
{
    public partial class ShenCengCYSQSJ : BasePage
    {
        #region 属性

        /// <summary>
        /// 保存结果集
        /// </summary>
        private DataTable dtSource
        {
            get
            {
                return ViewState["dtSource"] as DataTable;
            }
            set
            {
                ViewState["dtSource"] = value;
            }
        }

        #endregion

        #region 变量
        /// <summary>
        /// 水利普查
        /// </summary>
        QS_SLPCSJ1BLL SLPCBLL = new QS_SLPCSJ1BLL();

        /// <summary>
        /// 存储过程调用类
        /// </summary>
        SpHelper _SpHelper = new SpHelper();

        /// <summary>
        /// 操作日志BLL
        /// </summary>
        SYS_LOGBLL _SYS_LOGBLL = new SYS_LOGBLL();

        
        #endregion

        #region 事件

        /// <summary>
        /// 页面加载事件
        /// </summary>
        protected void Page_Load(object sender, EventArgs e)
        {
            //第一次页面加载
            if (!IsPostBack)
            {
                InitData();
            }
            LoadData();
        }

       

       

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            LoadData();
        }
        #endregion

        #region 方法

        /// <summary>
        /// 初始化数据
        /// </summary>
        private void InitData()
        {
            QS_JX_XINGZHENGQBLL XZQ = new QS_JX_XINGZHENGQBLL();
            DataTable dt = XZQ.SelectQS_JX_XINGZHENGQsDynamic("i_jlzt=0", null);
            cmbXZQ.Items.Add("全部", 0);
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                cmbXZQ.Items.Add(dt.Rows[i]["S_XINGZHENGQM"] + "区", dt.Rows[i]["S_XINGZHENGQH"]);
            }
            cmbXZQ.SelectedIndex = 0;
        }

        /// <summary>
        /// 数据加载
        /// </summary>
        private void LoadData()
        {
            string mc=txtMC.Text.Trim()!=null?txtMC.Text.Trim():null;
            string mc2=txtMC2.Text.Trim()!=null?txtMC2.Text.Trim():null;
            string xzq=cmbXZQ.Text!="全部"?cmbXZQ.Text:null;
            this.dtSource = _SpHelper.P_QS_SLPC(mc, mc2, xzq).Tables[0];
            
            gvList.DataSource = this.dtSource;
            gvList.DataBind();
            lbcount.Text = "共" + this.dtSource.Rows.Count.ToString() + "条";
        }

        #endregion        

       
    }
}